angular.module("httpService",[]).
service('staffService',function($http,$q){
    return {
        getDepartment:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/getAll'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getAll'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getStaffCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getStaffCount',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
          initPassword:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/initPassword',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByDepartmentId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getByDepartmentId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject();
                }
            });
            return promise;
        }, 
        updateByAdmin:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/updateByAdmin',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject();
                }
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject();
                }
            });
            return promise;
        },
         insertByAdmin:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/insertByAdmin',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject();
                }
            });
            return promise;
        },
        getStaffInfoByKeyWords:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getStaffInfoByKeyWords',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getStaffInfoByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getStaffInfoByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getStaffInfoByDepartment:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/getStaffInfoByDepartment',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        validate:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/staff/validate',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response);
                };
            });
            return promise;
        }
    };
}).
service("noticeService",function($http,$q){
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/notice/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/notice/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/notice/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/notice/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/notice/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }
    };
}).
service("busesService",function($http,$q){
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject(response);
                }
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                     deferred.reject("failed");
                }             
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByBusOrderId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getByBusOrderId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getInfo:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getInfo'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getInfoByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getInfoByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByBusOrderId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getByBusOrderId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
           getInfoByBusOrderId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/buses/getInfoByBusOrderId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }
    };
}).
service("busOrderService",function($http,$q){
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject(response);
                }
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject(response);
                }
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getById:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/getById',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getValidateOrders:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/getValidateOrders',             
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }, 
        getInvalidateOrders:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/busOrder/getInvalidateOrders',             
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
    };
})
.service("newsBlackBoardService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidateNews:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/getValidateNews',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    
  };
}).
service("departmentService",function($http,$q){
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/department/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
    };
}).
service("routesService",function($http,$q){
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/routes/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }, 
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/routes/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/routes/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/routes/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        },
      getByIdLimit:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:'/ticket/routes/getByIdLimit',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                };
            });
            return promise;
        }
    };
}).
service("ticketOrderService",function ($http,$q) {
    return {
      insert:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/insert',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
        adminInsert:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/adminInsert',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      delete:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/deleteByAdmin',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getInfoByBusId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/getInfoByBusId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getValidateTicketsInfoByStaffId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/getValidateTicketsInfoByStaffId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getInvalidateTicketsInfoByStaffId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:'/ticket/ticketOrder/getInvalidateTicketsInfoByStaffId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      }
    };
  }).
service("carPoolingService",function ($http,$q) {
  return {
    getValidateCarPooling:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/carpooling/getValidateCarPooling'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/carpooling/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
     delete:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/carpooling/delete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getCategory:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/carpooling/getCategory',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
}).
service("workBusesService",function($http,$q){
//  var baseUrl="http://www.npic.site:8888/mobile";
  return{
    getValidate0:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getValidate0',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidate1:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getValidate1',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/delete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
     getByOrientationAndDate:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getByOrientationAndDate',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidate:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getValidate',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInValidate:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getInValidate',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByCount:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workBuses/getByCount',
         method:'post',
        data:angular.toJson(data)
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
})
.service("workTicketService",function ($http,$q) {
    return{
         adminInsert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/adminInsert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    adminDelete:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/adminDelete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAuditingTicketInfoByAdmin:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getAuditingTicketInfoByAdmin',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    auditTicketInfoByAdmin:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/auditTicketInfoByAdmin',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
     getInfoByBusId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getInfoByBusId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidateTicketsInfoByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getValidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInvalidateTicketsInfoByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getInvalidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAuditingTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getAuditingTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAuditedTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/getAuditedTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    auditTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:'/ticket/workTicketOrder/auditTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
    };
});

